﻿using System.Collections.Generic;
using facebook.Schema;

namespace facebook
{
	/// <summary>
	/// Facebook application api methods.
	/// </summary>
	public class status
	{
		private readonly API _api;
		/// <summary>
		/// Public constructor for facebook.comments
		/// </summary>
		/// <param name="parent">Needs a connected API object for making requests</param>
		public status(API parent)
		{
			_api = parent;
		}

		/// <summary>
		/// 
		/// </summary>
		/// <returns></returns>
        public IList<facebook.Schema.status> get()
        {
            return get(0, 0);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public IList<facebook.Schema.status> get(long uid)
        {
            return get(uid, 0);
        }
        /// <summary>
		/// pass in 0 if you want the logged in user or the default of 100 messages
		/// </summary>
		/// <returns></returns>
        public IList<facebook.Schema.status> get(long uid, int limit)
		{
			var parameterList = new Dictionary<string, string> { { "method", "facebook.status.get" } };
            _api.AddOptionalParameter(parameterList, "uid", uid);
            _api.AddOptionalParameter(parameterList, "limit", limit);

			var response = _api.SendRequest(parameterList);
			return !string.IsNullOrEmpty(response) ? status_get_response.Parse(response).status : null;
		}
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        public bool set(string status)
        {
            return set(0, status);
        }
        /// <summary>
        /// pass in 0 if you want the logged in user or the default of 100 messages
        /// </summary>
        /// <returns></returns>
        public bool set(long uid, string status)
        {
            var parameterList = new Dictionary<string, string> { { "method", "facebook.status.set" } };
            _api.AddOptionalParameter(parameterList, "uid", uid);
            _api.AddOptionalParameter(parameterList, "status", status);

            var response = _api.SendRequest(parameterList, uid<=0);
            return string.IsNullOrEmpty(response) || status_set_response.Parse(response).TypedValue;
        }
    }
}
